#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
@Author: kindey
@Date: 2025/8/27
@Description: 
"""
import logging
import traceback
from django.views import View
from apps.utils.response_utils import success_response, error_response
from apps.services.tsfresh_service import YaliTimeService

class YaliTimeView(View):
    """
    不知道要干啥的的一个视图
    """
    logger = logging.getLogger(__name__)

    def get(self, request):
        """
        get请求
        :param request:
        :return:
        """
        try:
            self.logger.info("YaliTimeView get")
            YaliTimeService.get_feature()
            return success_response("YaliTimeView get")
        except Exception as e:
            self.logger.error(traceback.format_exc())
            return error_response(str(e))

class YaliTimePeriodicityView(View):
    """
    不知道要干啥的的一个视图
    """
    logger = logging.getLogger(__name__)

    def get(self, request):
        """
        get请求
        :param request:
        :return:
        """
        try:
            self.logger.info("YaliTimePeriodicityView get")
            analysis_results = YaliTimeService.comprehensive_periodicity_analysis()
            YaliTimeService.visualize_periodicity(analysis_results)
            return success_response("YaliTimePeriodicityView get")
        except Exception as e:
            self.logger.error(traceback.format_exc())
            return error_response(str(e))